jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.07k stars 218 forks source link

Performance tests #57

Open lavelle opened 11 years ago

lavelle commented 11 years ago

I think it would be good to get some performance tests added to the test suite before spending any time implementing new methods to improve performance.

This would help us prevent regressions, and even in cases like lavelle/BrowserFS#11 where it's fairly obvious that it will improve performance, it's nice to be able to quantify and measure the improvement.

This would also allow us to make comparisons of the relative speeds of the different backends, to have some quantitative evidence for users when they're weighing up the advantages and drawbacks of each.

I couldn't find any performance tests in the Node repo, but it wouldn't be too difficult to write our own.

jvilk commented 11 years ago

I agree with the desire for benchmarks, but I will not have time to do this for quite awhile.

It won't be difficult to write simple benchmarks, but it would be difficult to simulate a realistic filesystem workload. Simple benchmarks are a good start, though.

One benefit of emulating the node API: We can benchmark ourselves against Node. Granted, you'll probably want to do that in a RAM disk to isolate hard drive variability.

If you want to start work on this, please go ahead!

lavelle commented 11 years ago

Okay, I'll try and get some simple benchmarks for append and truncate done before I begin on the HTML5 FS performance improvements.

I'll make a wiki page for benchmarks.

lavelle commented 11 years ago

Made a start.

lavelle commented 11 years ago

Wiki page.

jvilk commented 11 years ago

OK. Here are some notes for your use:

Little checklist:

lavelle commented 11 years ago

Yeah, I agree that benchmarks and unit tests should be separate, I've already done that.

Don't see why we can't use Karma for both though, since it's already installed and configured. I've just passed in a boolean flag from the Makefile so it can decide which to run. Running a separate server for this seems kinda redundant.

jvilk commented 11 years ago

But with karma: How do you collect and present results? How do you easily profile the benchmarks? You need to hit debug, set a breakpoint, enable the profile, hit run again...

lavelle commented 11 years ago

I'd much rather stick with Karma's approach and have all input and output on the command line - tabbing to a browser and using a GUI is just going to disrupt workflow.

We can always have a command line tool for autogenerating a nicely formatted static HTML page with a summary of the benchmark results for easy sharing, since manually copying them into a wiki is cumbersome.

I hadn't thought about profiling - my use case for this is getting a quick overview of the total runtime to compare backends, rather than optimising individual lines of code. Could that be a separate tool for more intensive performance debugging, in addition to the command line tool for getting a summary?

jvilk commented 11 years ago

Oh, I wasn't concerned with how well it's presented.

And I'm currently suffering from profiling difficulties with Karma. Browsers hate it when you need to profile things that run when you open the page.

Feel free to continue with karma, but something like this will need to be built eventually (and I will definitely need soon; the Buffer implementation can probably be optimized...).

lavelle commented 11 years ago

Okay, well the vast bulk of the work (writing the benchmarks themselves) will be reusable. It's only a few lines of code being thrown away if you don't use Karma to run them, so I'll stick with this for now while I build a larger benchmark suite, and we can discuss the implementation details of the environment in which they're run further down the road.

jvilk commented 11 years ago

OK.

jvilk commented 10 years ago

What's the status of this? Is the general running-the-tests-with-karma logic ready for merging?

Here are some benchmarks that I would find useful for working on the current IE9 performance issues:

Backend-independent performance:

jvilk commented 10 years ago

I'm willing to write all of these, but I need something I can plug 'em into. :smile:

EDIT: And, of course, I'm not against you writing these yourself if you feel up to it. But I'd like them soonish.

wjordan commented 9 years ago

Just adding some potentially-helpful related resources for this item:

jvilk commented 9 years ago

These are all good resources. I agree that we should re-use these whenever possible.

Note that we would need to mark certain tests are using particular portions of the Node API. Some filesystems don't support synchronous file system operations, some don't support permissions, etc.

Also, most notably, my Buffer implementation doesn't support the index operation ([]), so those need to be replaced with get/set.