Skip to content

[improvment] how fast do you guys want your code?? #663

Closed

Description

@Tcll

looked through the code trying to figure out what used numpy and puked a few times.

your code is so pythonic (slow).

for example, do you know what the fastest method of type-checking is??
isinstance() is the slowest, and no type() isn't the answer, try something more direct.
give up? the answer is object.__class__, which is as fast as type-referencing gets.

I havn't played with setattr() and getattr() to know too much about them, I generally work in the python backend and work my magic there...
I can take a wild guess though that they're about as slow as a double-recursed function.

I'll give credit where due though...
due to the usage of the code, it's only ran once, and I've seen, and even written worse code.
hopefully in time the code will be improved...
(just because it's used for loading doesn't mean it should be slow as heck)

Activity

  1. kimkulling commented on Oct 8, 2015

    @kimkulling
    Member

    Thanks for the feedback. Do you have some hotspots?

  2. acgessler commented on Oct 8, 2015

    @acgessler
    Member

    PyAssimp has no current maintainer that I'm aware of, it's all more of less assorted pull requests.

    Some nits though

    isinstance()

    isinstance is readable, and it caters for inheritance.

    setattr, getattr

    They're builtins and (afaik) as fast as you can get. They only exhibit double-recursive behaviour if you use them to implement Ackermann's function :-)

    I've seen, and even written worse code.

    Now, you just volunteered yourself! :-)

    I would've suspected that the main cost comes from copying all the memory over and over again. Assimp's data structure incurs lots of small allocations. We need to profile things for more insights.

  3. kimkulling commented on Oct 28, 2015

    @kimkulling
    Member

    Any updates? If yes, just please reopen this issue. I have this on my lists of todos.

  4. added a commit that references this issue on Dec 11, 2023
  5. added a commit that references this issue on Feb 5, 2024
  6. added
    pyassimp
    on Apr 10, 2025
  7. added a commit that references this issue on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pyassimp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions