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

Optimize compilation for large global arrays #184

Merged
merged 2 commits into from Mar 6, 2018

Conversation

@rsKliPPy
Copy link
Contributor

@rsKliPPy rsKliPPy commented Mar 5, 2018

Introduces dumpdup opcode (compiler only). It helps with huge arrays with default values by creating only 1 dumpdup opcode instead of many dump opcodes together with a lot of vaues. Array indirection tables still use dump though, but they are small in size compared to the array data itself.

The following array:

bool x[32][1024][1024];

compiles in ~1.7s with this patch instead of ~9.5s on my machine.

compiler/sc1.cpp Outdated
defstorage();
} /* while */

stgwrite("dumpdup ");
Copy link
Member

@dvander dvander Mar 6, 2018

Choose a reason for hiding this comment

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

This change seems good - could you call it "dumpfill" or something instead? "dup" usually means something else in VMs and there's precedent for "fill" here.

Copy link
Contributor Author

@rsKliPPy rsKliPPy Mar 6, 2018

Choose a reason for hiding this comment

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

Sure, I wasn't keen on the naming anyway. I chose that naming because of ASM <times> DUP(<value>).
Do you want me to amend or create a new commit?

Copy link
Member

@dvander dvander Mar 6, 2018

Choose a reason for hiding this comment

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

Up to you - I'll squash it in the end.

Copy link
Contributor Author

@rsKliPPy rsKliPPy Mar 6, 2018

Choose a reason for hiding this comment

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

Done.
Out of curiosity - what's the usual meaning of "dup" in VMs?

@dvander
Copy link
Member

@dvander dvander commented Mar 6, 2018

Thanks!

@dvander dvander merged commit 017cf68 into alliedmodders:master Mar 6, 2018
2 checks passed
@rsKliPPy rsKliPPy deleted the improve-global-arrays branch Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants