Skip to content

Conversation

krux02
Copy link
Contributor

@krux02 krux02 commented Apr 12, 2018

This actually adds a test for identifier equality. Then it almost removes one instance of the many duplicates of cmpIgnoreStyle. Really copy pasting that function everywhere and then ensuring that the only central version in strutils.nim remains broken doesn't help at all.

The main motivation for this change is that eqIdent is called at lot in macros. I will also generate a lot of it form the ast pattern matching library that I am currently working on. I just wanted it to be fast.

@krux02 krux02 changed the title Strutils comment changes. move eqIdent to vm.nim Apr 12, 2018
@krux02
Copy link
Contributor Author

krux02 commented Apr 13, 2018

well I did this for performance optimizatioon and now the build fails because build time exceeds the maximum allowed time. Well the question is, was this my fault, or was there heave work load on the server and the built failed because of that?

@Araq Araq closed this Apr 13, 2018
@Araq Araq reopened this Apr 13, 2018
decodeBC(rkInt)
if regs[rb].node.kind == nkIdent and regs[rc].node.kind == nkIdent:
regs[ra].intVal = ord(regs[rb].node.ident.id == regs[rc].node.ident.id)
# aliases for shorter and easier to understand code below
Copy link
Member

Choose a reason for hiding this comment

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

This is not bad, but since rawExecute is already really long (!), it should be extracted into a helper proc.

## Style insensitive comparison.

proc eqIdent*(a: NimNode; b: string): bool {.magic: "EqIdent", noSideEffect.}
## Style insesitive comparison.
Copy link
Member

Choose a reason for hiding this comment

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

Typo here.

## ``a`` can be an identifier or a symbol.

proc eqIdent*(a: string; b: NimNode): bool {.magic: "EqIdent", noSideEffect.}
## Style insesitive comparison.
Copy link
Member

Choose a reason for hiding this comment

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

typo

## ``b`` can be an identifier or a symbol.

proc eqIdent*(a: NimNode; b: NimNode): bool {.magic: "EqIdent", noSideEffect.}
## Style insesitive comparison.
Copy link
Member

Choose a reason for hiding this comment

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

typo

@Araq Araq merged commit ed5b7cb into nim-lang:devel Apr 15, 2018
@krux02 krux02 deleted the eq-ident-in-vm branch April 15, 2018 22:52
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