Added a simple automata to read member names #47

Merged
merged 3 commits into from Aug 17, 2014

Projects

None yet

2 participants

@manofstick
Contributor

Rather than reading a string and then doing a dictionary lookup we
create a simple automata based on the names of the members, returning
the index of the setter method

Paul Westcott Added a simple automata to read member names
Rather than reading a string and then doing a dictionary lookup we
create a simple automata based on the names of the members, returning
the index of the setter method
5856168
@manofstick
Contributor

NB. This still needs to be extended for enums, as well as handling the case of escaped members.

Paul Westcott added some commits Aug 14, 2014
Paul Westcott Merge remote-tracking branch 'origin/master' into string-automata fb43140
Paul Westcott Fixed NameAutomata to handle escaped characters
I should put a more direct test in; i.e. the one at the moment relies on
turning off UseHashWhenMatchingMembers, but if that internal code was
changed then this isn't a strong guarentee that the Automata code path
is run.
3557dc7
@manofstick
Contributor

The handling of escaped characters has been added

@kevin-montrose kevin-montrose merged commit 3557dc7 into kevin-montrose:master Aug 17, 2014
@kevin-montrose
Owner

In testing this appears to be faster than hashing (in addition to being faster than dictionary lookups).

I haven't quite removed all of the hashing code though. It's still used in enum matching (as you've noted) and matching anonymous member names.

Anonymous types are a little fun since we have to create them via their constructor, rather than setting the properties after using the default constructor.

Removing the rest of hashing would be a good follow up PR.

@manofstick manofstick deleted the manofstick:string-automata branch Aug 18, 2014
@manofstick manofstick pushed a commit to manofstick/Jil that referenced this pull request Aug 18, 2014
@kevin-montrose + Paul Westcott remove hashing from non-anonymous member lookups; closes #47 2c95bd2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment