Giter Site home page Giter Site logo

Comments (3)

erezsh avatar erezsh commented on May 24, 2024

Hello!

Yes, Token.value is defined as string, for performance reasons. It's defined here: https://github.com/lark-parser/lark_cython/blob/master/lark_cython/lark_cython.pyx#L20

But nothing's stopping you from converting them to lark.Tokens, like so:

    return lark.Token.new_borrow_pos(t.type, float(t.value), t)

from lark_cython.

geographika avatar geographika commented on May 24, 2024

Thanks @erezsh, and thanks for this project!
This approach works fine for all the transformer functions that convert to any types that aren't str.
Does this approach however negate any performance boosts from using lark_cython? The full test suite went from 1min20 to 1min50 (a very rough benchmark).
I'll continue to play around and look at failing tests.

from lark_cython.

erezsh avatar erezsh commented on May 24, 2024

This shouldn't have any direct effect on lark-cython's performance. But it's possible that you are creating a lot of Token instances, and that's taking a lot of time. (I do remember mappyfiles having a lot of ints in them)

from lark_cython.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.