{"action":"created","issue":{"url":"https://api.github.com/repos/fdorg/flashdevelop/issues/969","labels_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/969/labels{/name}","comments_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/969/comments","events_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/969/events","html_url":"https://github.com/fdorg/flashdevelop/pull/969","id":120072790,"number":969,"title":"Ordinal String Comparison","user":{"login":"wise0704","id":13545633,"avatar_url":"https://avatars.githubusercontent.com/u/13545633?v=3","gravatar_id":"","url":"https://api.github.com/users/wise0704","html_url":"https://github.com/wise0704","followers_url":"https://api.github.com/users/wise0704/followers","following_url":"https://api.github.com/users/wise0704/following{/other_user}","gists_url":"https://api.github.com/users/wise0704/gists{/gist_id}","starred_url":"https://api.github.com/users/wise0704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wise0704/subscriptions","organizations_url":"https://api.github.com/users/wise0704/orgs","repos_url":"https://api.github.com/users/wise0704/repos","events_url":"https://api.github.com/users/wise0704/events{/privacy}","received_events_url":"https://api.github.com/users/wise0704/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-12-03T01:14:56Z","updated_at":"2015-12-07T09:07:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fdorg/flashdevelop/pulls/969","html_url":"https://github.com/fdorg/flashdevelop/pull/969","diff_url":"https://github.com/fdorg/flashdevelop/pull/969.diff","patch_url":"https://github.com/fdorg/flashdevelop/pull/969.patch"},"body":"[https://github.com/wise0704/flashdevelop/tree/StringComparison_Ordinal]\r\n\r\nThe default behaviours of \r\n```C#\r\nstring.StartsWith(string)\r\nstring.EndsWith(string)\r\nstring.IndexOf(string)\r\nstring.IndexOf(string, int)\r\nstring.IndexOf(string, int, int)\r\nstring.LastIndexOf(string)\r\nstring.LastIndexOf(string, int)\r\nstring.LastIndexOf(string, int, int)\r\n```\r\nare to call the equivalent overloaded methods with `StringComparison.CurrentCulture` as the last parameter. These are in fact much slower than the ordinal (character correspondence) string comparisons. \r\n\r\nThe solution I've provided is to have a string extension class in `PluginCore` namespace that provides the extension methods corresponding to the ones above, with the suffix `Ordinal` added to them (e.g. `string.StartsWithOrdinal(string)`). \r\n\r\nI see no point of using culture-relevant comparisons in any case for FlashDevelop unless I've missed something, so I changed all ~~**589!!!!!**~~ occurrences of those above, with either the extension methods, or in case of `IndexOf` and `LastIndexOf` with length-1 strings, to `char`'s. ~~_I'm dying after that_~~.\r\nE.g.\r\n```C#\r\nstr.StartsWith(str2) -> str.StartsWithOrdinal(str2)\r\nstr.IndexOf(\"#\") -> str.IndexOf('#')\r\n```\r\n\r\nFrom now on, can everyone please be careful not to use the implicit culture-specific methods of string? There are 2 ways to avoid them:\r\n * Explicitly specify `StringComparison.Ordinal` every time.\r\n * Use my extension ~~coz i need someone to appreciate me changing a total of 589 references~~."},"comment":{"url":"https://api.github.com/repos/fdorg/flashdevelop/issues/comments/162454321","html_url":"https://github.com/fdorg/flashdevelop/pull/969#issuecomment-162454321","issue_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/969","id":162454321,"user":{"login":"Neverbirth","id":2273861,"avatar_url":"https://avatars.githubusercontent.com/u/2273861?v=3","gravatar_id":"","url":"https://api.github.com/users/Neverbirth","html_url":"https://github.com/Neverbirth","followers_url":"https://api.github.com/users/Neverbirth/followers","following_url":"https://api.github.com/users/Neverbirth/following{/other_user}","gists_url":"https://api.github.com/users/Neverbirth/gists{/gist_id}","starred_url":"https://api.github.com/users/Neverbirth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Neverbirth/subscriptions","organizations_url":"https://api.github.com/users/Neverbirth/orgs","repos_url":"https://api.github.com/users/Neverbirth/repos","events_url":"https://api.github.com/users/Neverbirth/events{/privacy}","received_events_url":"https://api.github.com/users/Neverbirth/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T09:07:35Z","updated_at":"2015-12-07T09:07:35Z","body":"Just an idea, @wise0704 said he is on a slow computer, so he should be able to easily make a profiling session between an unmodified FD version and this one while using the parts of the application that make the most use of the modified code, and then tell the results with the profiling reports."}}