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

Update threephase package #173

Merged
merged 7 commits into from
Aug 8, 2014
Merged

Update threephase package #173

merged 7 commits into from
Aug 8, 2014

Conversation

cs0x7f
Copy link
Contributor

@cs0x7f cs0x7f commented Aug 2, 2014

After optimization, the initialization time of threephase is now less than 7 seconds on my laptop.
BTW, once I try to compile it into javascript, the generated .js file doesn't contain the threephase package. Do you know how to compile it with threephase package included?

@pochmann
Copy link

pochmann commented Aug 2, 2014

How long did initialization take before this optimization?

@cs0x7f
Copy link
Contributor Author

cs0x7f commented Aug 3, 2014

More than 20 seconds with multi-thread acceleration.

@jfly
Copy link
Contributor

jfly commented Aug 5, 2014

Thanks for doing this! I just got back from US Nationals, and will take a look at this once I'm on a laptop.

Did you see that the travisci build failed? Any idea why?

@jfly
Copy link
Contributor

jfly commented Aug 5, 2014

To answer your other question, random state 4x4 is excluded from the GWT build in this file https://github.com/cubing/tnoodle/blob/master/scrambles/src/scrambles.gwt.xml

I remember that 4x4 took ~15 minutes in Chrome on my laptop and maybe 15 seconds per scramble. I'm really excited to see how it performs with your changes!

c.set(i);
for (int j=0; j<48; j++) {
int idx = c.get();
occ[idx>>>5] |= (1<<(idx&0x1f));
raw2sym[idx] = count << 6 | syminv[j];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is your code, but I would put more parens here, it's not obvious to me what the order of operations is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"raw2sym" is a temporary array for accelerating the initialization of the Center1 move table by replacing the "int getsym()" function. After the initialization of the move table, the "raw2sym" table can be removed as the "int getsym()" function won't be called much times later.

@cs0x7f
Copy link
Contributor Author

cs0x7f commented Aug 7, 2014

The initialization time of the javascript version is about 4~5 seconds on my laptop with some javascript-based optimization.
I'm not sure why travisci build failed. The log says that there's something wrong in project "tnoodle-android"...

@cs0x7f cs0x7f closed this Aug 7, 2014
@cs0x7f cs0x7f reopened this Aug 7, 2014
@jfly
Copy link
Contributor

jfly commented Aug 7, 2014

Wow, that's awesome! 4-5 seconds is huge. What sort of javascript optimizations are you making?

Are you able to build tnoodle-android locally? Try out "./tmt make -p tnoodle-android".

@jfly
Copy link
Contributor

jfly commented Aug 7, 2014

I just ran a vanilla tnoodle build, and it looks like it's hitting this issue too: https://travis-ci.org/cubing/tnoodle/builds/21301678, so this doesn't look like it has anything to do with your changes. I'll look into this.

@jfly
Copy link
Contributor

jfly commented Aug 8, 2014

I did some magic to .travis.yml and cubing/tnoodle is happy again: https://travis-ci.org/cubing/tnoodle/builds/31967546. Pull in that change, and hopefully your travisci build will pass.

@cs0x7f
Copy link
Contributor Author

cs0x7f commented Aug 8, 2014

Well, I've integrated the converted and optimized javascript version into cstimer(http://www.cstimer.net/new/). You can check the uncompressed version at:
http://2.cstimer.sinaapp.com/
The 4x4x4 random state scrambler is defined in file "http://2.cstimer.sinaapp.com/js/scramblers/scramble_444.js"
The initialization time is about 5 seconds on my laptop and less than 1 second per scramble.

@jfly
Copy link
Contributor

jfly commented Aug 8, 2014

http://2.cstimer.sinaapp.com/js/scramblers/scramble_444.js is the optimized version, or the unoptimized version? Can you send me links to both, so I can diff them and compare?

What do we need to do to get tnoodle/gwt to produce the best javascript by default? GWT has good support for overriding functions/methods with hand written javascript if need be.

@cs0x7f
Copy link
Contributor Author

cs0x7f commented Aug 8, 2014

It's the optimized version. The unoptimized version can be generated via tnoodle(./tmt make dist -p tnoodlejs). I removed most of the redundant functions and operations, such as "depth << 24 >> 24" => "depth" because "depth" is always < 128 although the type of "depth" is "byte" in java.
I think use GWT is acceptable. The optimization can also be finished in java. See the variable "IS_64BIT_PLATFORM" in Edge3.java, which is set to false when compiling to javascript or executing on handheld devices (such as android version).

@jfly
Copy link
Contributor

jfly commented Aug 8, 2014

This is working great for me. Really awesome work.

I've added a comment here https://github.com/cubing/tnoodle/issues/114#issuecomment-51654014 to look into changing tnoodle so that we produce better javascript by default, but that might be a hard problem to solve.

jfly added a commit that referenced this pull request Aug 8, 2014
Update threephase package to be way faster at generating pruning tables.
@jfly jfly merged commit a978614 into thewca:master Aug 8, 2014
jfly added a commit to jfly/tnoodle that referenced this pull request Aug 8, 2014
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.

3 participants