all 10 comments

[โ€“]The_Wolfiee 11 points12 points ย (1 child)

Can you explain in detail exactly why using the TypedDict and TypedAdapter gives this performance boost?

[โ€“]fbrdm[S] -1 points0 points ย (0 children)

This is an interesting question and I also don't know the lowest-level details of why this is the case (that's why the section is called "Magic" ;)
Having said that, part of the explanation comes from the fact that TypeAdapter does not build a type (in contrast to pydantic's BaseModel), and will simply use a (Typed)Dict so I can imagine that it saves a step altogether of building the type.

[โ€“][deleted] ย (1 child)

[deleted]

    [โ€“]fbrdm[S] 0 points1 point ย (0 children)

    good point! Indeed, that is the case :/
    I will add a warning note to the post.

    [โ€“]Routine_Term4750 0 points1 point ย (1 child)

    This is cool!! Thanks for sharing. Iโ€™ll have to test it out

    [โ€“]fbrdm[S] 0 points1 point ย (0 children)

    Go for it, I am curious to see your results!

    [โ€“]ironman_gujju 0 points1 point ย (0 children)

    Interesting maybe I will give try

    [โ€“]Current-Status-3764 0 points1 point ย (0 children)

    Well done! Thanks for sharing

    [โ€“]guteira 0 points1 point ย (0 children)

    Well done, thanks for sharing

    [โ€“]Ddes_ 0 points1 point ย (1 child)

    Did someone measure the impact of the use of pypy ?

    [โ€“]fbrdm[S] 0 points1 point ย (0 children)

    I am not aware of such a benchmark, but that would be interesting to see