Comments (11)
This is a great idea, thanks! Also, it's easy to implement
How much faster is compilation right now with Riml.compile_files
vs shelling out? I'm curious because it's compiling each file that's given to Riml.compile_files
in its own thread, and if it's just 2 files then thread creation overhead may negate any speed benefits. Regardless, most of the speed benefits probably come from not creating new shells.
I'm also going to use yard
to document all public API methods like this, to make it easier to use Riml
outside of a command-line setting like you're doing here.
I'll let you know when this is ready :)
from riml.
How much faster is compilation right now with Riml.compile_files vs shelling out?
Quite a bit. It eliminates the boot time of ruby. And it's saving is proportional to the size of the suite.
I'm curious because it's compiling each file that's given to Riml.compile_files in its own thread, and if it's just 2 files then thread creation overhead may negate any speed benefits.
I suspect I'm not seeing this as I am passing in one file at a time to compile_files
. I have a Rake FileList
rather than an array, so looping over it with each
.
from riml.
I noticed a boost in compile times, Looks like this is working in master?
from riml.
Hey @dsawardekar, this is indeed working in master, I'm glad you noticed a speed increase
I'll make a release tomorrow off, and this will be included.
Thanks again for the suggestion.
from riml.
Thanks. I will update Speckle, this is an awesome update! :)
from riml.
@luke-gru About this update, It shaved about 20 seconds of the build time of Portkey! So this was a really nice update.
Not trying to be greedy, But I think you can do even better! The time taken for a complete compile of Portkey is about 5 seconds. About 1 second for plugin.riml
and 4 seconds for portkey.riml
which is the autoloaded main application.
Yet the whole test suite compilation takes about 40-50 seconds. Some of the tests include the entire app with portkey_inc.riml
which a file that includes all the individual classes. It still feels like it is compiling the individual includes.
In contrast running the test suite in Speckle zips by in under 1 second, compiling about 10+ files. Speckle does not have any nested includes.
Does the the riml_include
cache take into account nested includes?
from riml.
Hmm, this is interesting, as I suspected it did this already, but I didn't benchmark anything at all, so I kind of tested it the lazy way.
If you take a look at https://github.com/luke-gru/riml/blob/master/test/integration/riml_commands/compiler_test.rb#L287, the mocked cache object I'm using during testing is apparently called with the nested includes, but something must be wrong if it's taking so long to compile.
I'll take a look at this, and make sure to add some benchmarks to the testing process, as the compile times are a little worrying right now, 40-50 seconds is pretty bad. I'm sure we can do better than that
EDIT: I didn't know about Portkey! Looks awesome, I'm going to check it out.
from riml.
I'll take a look at this, and make sure to add some benchmarks to the testing process, as the compile times are a little worrying right now, 40-50 seconds is pretty bad. I'm sure we can do better than that
😄
Would assembly after compilation take too much times? If you run rake
in the Portkey project you'll see it will start off pretty fast with the initial files, then when it reaches the controllers it's slows down. These are the tests that include portkey_inc.riml
.
You can even see this isolated with,
$ speckle spec/controllers/commands/alternate_file_command_spec.riml spec/controllers/commands/related_file_command_spec.riml
These are E2E tests. Both these specs are very similar in size. Compiling the alternate command should compile the entire app. The related command should then be just a quick cache lookup + the tests in the file itself which is only a handful of methods.
The related command still takes a 2-3 seconds to compile. Adding a number of these commands is what is adding up to 40+ seconds in the whole suite.
from riml.
@luke-gru Compile times now down to 12 seconds in Portkey in master. Awesome work! Are you certain there were no sleep(10)
calls in there?
from riml.
haha, thanks. No sleep
calls riml_include
. I made the caching better, and then to top it off there was some low-hanging fruit optimizations that I made regarding Riml.source_path
and Riml.include_path
caching as well. Before, whenever the compiler hit a riml_source
or riml_include
line, it would go over each directory in the path and check the filesystem to see if the files existed. All the filenames in both paths are now cached when they're set, so this saves some time too.
from riml.
Neat stuff. I'm glad I kept asking for more. At 12 seconds it's around the same time it takes the full suite to run. Can't ask for more now! :)
from riml.
Related Issues (20)
- Syntax error with dot access of "append" property on argument HOT 2
- Functions starting with uppercase letter HOT 2
- Make 1.8.7 compatible HOT 1
- smarter `riml_include` re-orders inclusions based off dependency graph for classes HOT 10
- add `riml_import` for importing classes. Once imported, you can use them without 'undefined class' errors. HOT 2
- Cache SID result HOT 2
- Minimum and Recommended version of Vim for `riml` generated code HOT 4
- `for` statement in global scope pollutes global variables HOT 3
- Functions that handle range HOT 2
- Upgrading to riml 0.3.7 doesn't pickup some classes in path HOT 4
- class method name generation error HOT 6
- exception when calling method on a list item in one statement HOT 13
- bug in boolean assignment
- calling self method with splat args fails
- Calling super in a class without extending a parent class HOT 1
- Strings with interpolation don't work with escaped single quotes.
- The pyeval function is not treated as a system function
- Viml generated by Riml is incompatible with Vim p260 or higher HOT 3
- Variables inside function should compile to local to function scope
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riml.