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

minor optimisations to DataTypeMapper #53

Merged
merged 1 commit into from
Jul 17, 2016
Merged

Conversation

mcshaz
Copy link
Contributor

@mcshaz mcshaz commented Jul 15, 2016

as per comments in issue #36.

@mcshaz mcshaz changed the title minor optimisations to datatypemapper minor optimisations to DataTypeMapper Jul 15, 2016
@rianjs
Copy link
Collaborator

rianjs commented Jul 15, 2016

Viewing on mobile but looks plausible. I think going forward, I'd like a unit test demonstrating that caching dictionaries are thread safe in concurrency scenarios. See the bug I fixed 2 days ago for an example test case. Basically create a unit test with .AsParallel call. If the unit test I wrote the other day covers this by invoking that machinery under the hood, that should be ok. (Just let me know that that is the case.)

Edit, pr link: #41

@mcshaz
Copy link
Contributor Author

mcshaz commented Jul 16, 2016

Apologies if I am mistaken - I would be lucky to have a tiny fraction of your programming knowledge (and I am not being humble - my day job has very little to do with computers) - I just wanted to make sure you had seen the changes did not introduce the use of dictionaries (which were pre-existing in the code) - the changes were merely:

  • replacing the parameter-less constructor for a dictionary with a constructor specifying a StringComparer.OrdinalIgnoreCase, in order to prevent every lookup value for the dictionary being converted to uppercase first.
  • replacing the pattern of if (dictionary.Contains(key)) {return dictionary[key]} with the dictionary.TryGetValue method - avoiding 2 lookups where 1 would do.

@rianjs rianjs merged commit bc3a783 into ical-org:master Jul 17, 2016
@rianjs
Copy link
Collaborator

rianjs commented Jul 17, 2016

Quite right. Much easier to see on a real computer. :)

@mcshaz mcshaz mentioned this pull request Jul 19, 2016
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