I got the "RouterOS by Example" book (Kindle Edition) by Stephen Disher.
Reading trough it, I came to discussion of the Mangling feature, where he talks about how CPU intensive packet mangling can be, if we have to look at every packet.
So he suggests an "Optimal Mangle" method, a two step process where we: (1) Identify connections that are flowing the packets we want to mangle. (2) Mark the packets."
The thing that doesn't make sense is that it seems he is still examining every packet, and now he has processed the matching packets twice.
The first rule might specify a chain of prerouting, a protocol of tcp, and a dst port of 80. Packets matching this will have an action of "mark connection" with a mark we specify like "WebBrowsingConnections."
A subsequent rule then looks in the prerouting chain for the connection mark we set in our previous rule ("WebBrowsingConnections") and then uses the action "mark packet" as "WebBrowsingPackets."
I cannot see how that is faster.
I can see how it might lead to easier/better organization, but we're still looking at every packet in order to perform that first rule that does the "mark connection?"
Am I thinking incorrectly on this?