Giter Club home page Giter Club logo

Comments (5)

lindahua avatar lindahua commented on June 1, 2024

IMO, it should just do allocation.

For ordinary Julia arrays, similar(a) returns something whose contents are completely random/undefined. People can use fill and whatever to initialize the content. The same should be similar for data arrays. People can initialize everything to NA or not NA using additional statements.

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 1, 2024

Let's see what @simonster thinks. If he agrees, we should make the change. After that, we need to review the codebase to make sure that we set NA properly in anything generated by similar.

from dataarrays.jl.

simonster avatar simonster commented on June 1, 2024

All other things being equal, I think it's more user-friendly to do NA setting. I don't think there's much point in consistency with Base for consistency's sake, since the behavior is not even entirely consistent there (bits types get random values, but other types get #undefs, which presumably requires zeroing the array of pointers). NA setting seems unlikely to cause much confusion; code that expects an uninitialized array should work just fine with a DataArray full of NAs.

If there's a performance impact of NA setting, that would be a good reason not to do it, but my intuition is that it would be minimal. For Ints and Float64s, there are 64x as many bits in the data array as in the na array. For code that does nothing but fill the data array, the cost to fill the na array should be <2% of the total time, and for anything more complicated it is likely immeasurably small.

from dataarrays.jl.

lindahua avatar lindahua commented on June 1, 2024

@simonster's argument is fair enough to me.

from dataarrays.jl.

johnmyleswhite avatar johnmyleswhite commented on June 1, 2024

Yeah, I think this is a reasonable hypothesis. Let's use Simon's auto-NA semantics until there's a legitimate performance problem. I'll add a few tests to make sure we're doing this correctly.

from dataarrays.jl.

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.