Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups and speedups for T::P and T::P::Grid construction #13

Merged
merged 6 commits into from
Oct 17, 2016

Conversation

japhb
Copy link
Collaborator

@japhb japhb commented Oct 17, 2016

5 commits (plus a merge) that clean up and speed up construction of T::P and T::P::Grid.

At this point the major slowdown at initial startup is loading T::P itself, because of the remaining 'no precompilation' infection from OO::Monitors; discussing that separately with jnthn.

Instead of trying to keep T::P's @.indices up to date with changes to
$.current-grid, just let $.current-grid handle the indices method itself.
Mostly just readability improvements and very minor simplification.
Rather than iterating over @indices to build @grid, make use of xx instead
since we're just filling all cells with an identical constant.  This is many
times faster, enough to make .new about 2x faster overall for a full-screened
terminal on my laptop.

The run time for Grid.new is now dominated by the time to build @indices.
The grid indices are not needed in many use cases, so initialize them lazily
to make the common/base cases faster.
Now that the current-grid is handling .indices, the attribute declaration
isn't needed anymore.
@ab5tract ab5tract merged commit 9fabce5 into ab5tract:master Oct 17, 2016
@ab5tract
Copy link
Owner

Cheers, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants