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

support running inefficient programs in the vm #13135

Closed
wants to merge 1 commit into from

Conversation

disruptek
Copy link
Contributor

What can I say? I'm not good at it and I have a lot of friends that write software even less efficient.

What can I say?  I'm not good at it and I have a lot of friends that write even less efficient software.
@juancarlospaco
Copy link
Collaborator

Why not just add {. intdefine .} and write end user documentation about how to set it.

@Araq
Copy link
Member

Araq commented Jan 14, 2020

Can you give us a reasonable example where this limit really hurts us?

@disruptek
Copy link
Contributor Author

No, but it hurts me personally:

  • I can't build any of the larger openapi inputs for the big cloud services without this change.
  • I have to frequently stash patches and switch kernels every time I want to run a lot of openapi.
  • We /want/ people to exploit the limits of the software and demonstrate all they can do in the VM; telling users they need to patch their compiler in order to build a complete AWS/EC2 API seems pretty discouraging.

Can you give me some painful examples where the limit helped? Should I be looking into my performance problem?

@timotheecour
Copy link
Member

I have also run into this limit and had done the change locally (except as below):

  • this should use:
const nimVMMaxLoopIterations {.intdefine.} = 10_000_000
const MaxLoopIterations = nimVMMaxLoopIterations

so that user can override, and so that we respect the nim prefix convention (pending nim-lang/RFCs#181)

  • you also need to update this:
compiler/vm.nim:547:21:    "compiler/vmdef.MaxLoopIterations and rebuild the compiler"

and this: tests/vm/tmaxloopiterations.nim

@disruptek
Copy link
Contributor Author

To be clear, I'm just trying to parse some JSON. Sure, it's not tiny, but under 100k lines, or about 4mb.

I don't think anyone should have to pass an option to the compiler if they want to consume a few hundred megs of data at compile-time. Maybe I'm alone in this view, however.

@timotheecour
Copy link
Member

timotheecour commented Jan 22, 2020

@disruptek the point is there is no "one true limit" (except unlimited but that would prevent catching certain bugs where VM runs in infinite loops for eg); what if your use case happens to be just above the new limit you put?

I did run into the existing limit (for a different scenario) and I welcome a PR that looks like #13135 (comment) (and ok if you change the default to something higher as part of the PR in addition to the intdefine)

@disruptek
Copy link
Contributor Author

I've already made a PR to raise the limit for my use-case. If your use-case happens to be just above the new limit that I put, well, I also welcome a PR that looks like #13135 (comment).

But, to my eye, the fact that this PR is not that PR is not sufficient reason to reject it.

@timotheecour
Copy link
Member

timotheecour commented Jan 22, 2020

@disruptek I think #13233 is a better approach; it doesn't require recompiling nim to change the default max number of loops

@disruptek disruptek closed this Jan 22, 2020
@disruptek disruptek deleted the patch-6 branch November 22, 2020 23:08
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.

4 participants