51Degrees / Device-Detection

THE Fastest and most Accurate device detection for C / PHP / Perl / Python and Node.js - professionally maintained device data

Home Page:https://51degrees.com/device-detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

trie: expose more useful variables and functions

yorkie opened this issue · comments

Hey @51Degrees,
see this commit 51Degrees/51degrees.node@7028545 from 51degrees.node..

Node is a v8 program, so it has built-in json/js library, in this case the processDeviceJSON will be expensive(convert to string, and call JSON.parse).

So I do implement the dataSet iterator at c++ part, it's more faster and scale.

Caveat in Trie

In trie mode, you use few static variables like _requiredPropertiesNames, _requiredPropertiesCount etc, those variables/functions cannot be accessed from any other places, it caused difficult to implement a parser based on v8 api.

To address the issue, i injected your source code to expose those variables/functions what i'd like to use in my parser function, however it's hacky, so i'm looking forward this change will be merged into c library.

Another problem with your processDeviceJSON

see 51Degrees/51degrees.node#6
I'm inspired by this issue that says "Kindle Fire HDX 7" (3rd Gen)" should be converted to "Kindle Fire HDX 7\" (3rd Gen)", this maybe a bug of c library or data? I'm unsure this problem.

Closed as this issue applied to a now deprecated API.