Skip to content

feat(css): Added optional css-tree parser #8076

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

Merged
merged 3 commits into from
Dec 5, 2019
Merged

Conversation

darind
Copy link
Contributor

@darind darind commented Nov 8, 2019

PR Checklist

What is the current behavior?

The developer can choose between rework and nativescript css parsers (rework being the default)

What is the new behavior?

The developer can choose between rework, nativescript and css-tree (rework being the default)

According to benchmarks, css-tree is the fastest available css parser written in javascript at the moment. It is orders of magnitude faster than the default rework parser.

@cla-bot cla-bot bot added the cla: yes label Nov 8, 2019
@darind darind force-pushed the darind/css-tree-parser branch from 680e0f4 to 5eb7569 Compare November 8, 2019 12:36
@pana-cc
Copy link

pana-cc commented Nov 8, 2019

This is awesome. Do we have some times comparing the 2 parsers you've given with the one at: https://github.com/nativescript/css-parser
on iOS and Android devices?

@darind darind self-assigned this Nov 8, 2019
@darind
Copy link
Contributor Author

darind commented Nov 8, 2019

@pana-cc, yes I have compared the performance of the two parsers using the new V8 based iOS runtime. As a reference for my tests I used a pretty large CSS file (192KB from the bootstrap project):

css-tree css-parser
408ms 7297ms

The big difference comes from the fact that the css-parser uses regular expressions which are not very efficient when V8 runs in jitless mode (iOS). I have found that css-tree is the fastest possible javascript based CSS parser in this scenario. Until we implement a CSS parser in pure C++, css-tree seems to be efficient enough and also standards compliant.

@pana-cc
Copy link

pana-cc commented Nov 8, 2019

I was going to add the css-parser to benchmarks but that's totally pointless now. Real iron is what only matters. Back in the time when I was writing css-parser iOS was not running on V8.

Good job!

@darind darind force-pushed the darind/css-tree-parser branch from 5eb7569 to 680b6b6 Compare November 11, 2019 15:13
@manoldonev manoldonev self-requested a review November 11, 2019 15:31
@darind darind force-pushed the darind/css-tree-parser branch from 680b6b6 to ad16c5c Compare November 18, 2019 14:21
@MartoYankov
Copy link
Contributor

test --ignore branch-animations#myankov/css-tree branch-groceries#myankov/css-tree api24 ios12

2 similar comments
@manoldonev
Copy link
Contributor

test --ignore branch-animations#myankov/css-tree branch-groceries#myankov/css-tree api24 ios12

@dtopuzov
Copy link
Contributor

test --ignore branch-animations#myankov/css-tree branch-groceries#myankov/css-tree api24 ios12

@darind darind force-pushed the darind/css-tree-parser branch 5 times, most recently from 99705bf to 67c1e96 Compare December 3, 2019 14:18
@vakrilov vakrilov added the docs needed Additional documentation on this issue/PR is needed label Dec 3, 2019
@dtopuzov
Copy link
Contributor

dtopuzov commented Dec 4, 2019

test --ignore branch-animations#myankov/css-tree branch-groceries#myankov/css-tree api24 ios12

@darind darind force-pushed the darind/css-tree-parser branch from 1f08bf8 to edd0cbc Compare December 4, 2019 12:54
@dtopuzov
Copy link
Contributor

dtopuzov commented Dec 4, 2019

test --ignore branch-animations#myankov/css-tree branch-groceries#myankov/css-tree api24 ios12

@vakrilov vakrilov merged commit 49a7607 into master Dec 5, 2019
@vakrilov vakrilov deleted the darind/css-tree-parser branch December 5, 2019 08:23
rynop pushed a commit to rynop/NativeScript that referenced this pull request Dec 6, 2019
* feat(css): Added optional css-tree parser

* test: css-tree parser compat tests

* test: more css-tree compat tests
vakrilov added a commit that referenced this pull request Jan 10, 2020
* feat: add 3d rotation

* chore: fix build errors

* chore: fix tslint errors

* chore: add @types/chai dev dep

* chore: unused import cleanup

* chore: update tests for x,y rotation

* chore: rebase upstream/master

* fix: iOS Affine Transform test verification

* feat(css): Added optional css-tree parser (#8076)

* feat(css): Added optional css-tree parser

* test: css-tree parser compat tests

* test: more css-tree compat tests

* feat(dialogs): Setting the size of popup dialog thru dialog options (#8041)

* Added iOS specific height and width attributes to ShowModalOptions

* Set the height and width of the popup dialog to the presenting controller

* dialog options ios attributes presentationStyle, height & width are made optional

* Updated NativeScript.api.md for public API changes

* Update with git properties

* Public API

* CLA update

* fix: use iOS native-helper for 3d-rotate

* test: Fix tests using _getTransformMismatchError

* fix: view.__hasTransfrom not set updating properly

* test: fix css-animations test page

Co-authored-by: Alexander Vakrilov <alexander.vakrilov@gmail.com>
Co-authored-by: Darin Dimitrov <darin.dimitrov@gmail.com>
Co-authored-by: Shailesh Lolam <slolam@live.com>
Co-authored-by: Dimitar Topuzov <dtopuzov@gmail.com>
@rigor789 rigor789 removed the docs needed Additional documentation on this issue/PR is needed label Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants