task serialize() quite a bit slower on Ansible 2.4 as compared to Ansible 2.3

Hi there,

I’m using a custom callback plugin, which does a task.serialize() for every new task in a playback, in order to get some task details I can’t get otherwise.

Up until Ansible 2.3 that caused a bit of a slowdown, but acceptable. Upgrading to 2.4 made my playbooks run really slow though, and I’ve tracked it down to the task.serialize() function. If I comment that out in my callback, playbooks run approximately twice as fast. Ansible 2.3 is still faster, but I could live with that.

Anybody got an idea why task.serialize() is so much slower in the new version? Or how to speed it up in some way or other?

Thanks!

Marcus

Sorry I don’t know the code well enough, but taking a step back, what does your custom callback need this for, maybe there’s another way to solve this problem?

Yes, that’s what I eventually ended up doing. Turns out I can actually get everything I need from the task and role classes directly, which makes my code faster and cleaner.

I’d still be curious as to why performance of serialize() is suddenly so much worse. Might have something to do with the overall slowdown issues that are being reported.

Either way, thanks! All good now!