Giter Club home page Giter Club logo

Comments (2)

steve-s avatar steve-s commented on August 16, 2024

Hi Adam,

thank you for reporting this. Coincidentaly, we've been recently looking into data.table and adding support for missing functionality in FastR that data.table uses, for example in [1]. This issue that you pointed out is indeed caused by implementation difference, in a longer term we may slightly rework our data representation to support this scenario. However, there are more fundamentals problems with data.table, so I don't think we can support that package "as is" right now or in near future unless the authors decide to modify it. We're also considering providing a patched version for FastR. For technical details please read on.

The fundamental problem with data.table is that it uses the DATAPTR macro to access internal data of vectors and copy them using e.g. memcpy. In FastR we can support this for atomic types, but it is suboptimal and if you do this to character vectors, it will confuse the Java GC. In fact, it's also not the recommended approach even for GNUR GC [2], but unlike us it can tolerate it. One possibility is to provide data.table patched for FastR. Another is that the ALTREP GNU R branch [3] gets merged and it motivates the data.table authors to use Dataptr_or_null before using DATAPTR and providing an alternative code path if using DATAPTR is not desired (i.e. Dataptr_or_null returns null).

The issue that you pointed out is interesting: data.table checks that list(x) does not copy x, which even in FastR it doesn't, however, to check that no copy was made data.table uses C function address. FastR has efficient representation of sequences, but we have to materialize this compact representation to full vector when it is passed to native code, hence the address function returns different values each time it gets called with the same compact sequence.

P.S.: thank you for the kind words and please feel free to share with us more about how you use FastR and which other packages are important for your scenario.

[1] cbeedb4
[2] https://cran.r-project.org/doc/manuals/r-release/R-ints.html#The-write-barrier
[3] https://www.r-project.org/dsc/2017/slides/dsc2017.pdf

from fastr.

steve-s avatar steve-s commented on August 16, 2024

There is now FastR specific version of data.table. It can be installed in FastR using:

install.fastr.packages('data.table')

I am closing this issue. If you encounter any issues with concrete data.table examples that don't work on FastR, please open new issues for those.

from fastr.

Related Issues (20)

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.