Skip to content

Array: Reconsider defined checking #2

@DavidRaab

Description

@DavidRaab

Should they be removed?

Currently i check defined in some functions, and in some other i don't. I do that to usually avoid defined values. But constant checking creates some performance overhead. Overhead that also is usually not needed everywhere because in creation of an Array i usually do some checking to avoid those values. Function that create an Array usually use defined to abort the creation
of an Array.

In some other functions so far it seems sometimes i do defined checking to abort or either skip values. And in some others
i don't do anything about them.

This has to be consistent:

  • undef aborts creation when creating an array.
  • undef usually aborts iterating an array when it appears.

Otherwise i could do just do nithing with them and consider it a programming bug/error when a programmer has undef
in arrays, not a problem with Sq.

A reason for removing those checks are that they create a constant performance hit for every element that is processed in
an array. This check makes things slower and this performance hit is also what you get with Arrays containing no undef at all.
While I like some defensive programming that helps in writing good code i am not a big fan of being too much defensive, especially not when performance has to suffer for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    todowill be done, but not highest priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions