pflua-match: Work on arrays of packets, not pointers

This change makes the filter function much tidier, but massively increases performance variance on small data sets (it evens out on larger ones). It retains the property of having no CNEWI calls, as does the sink_cnewi branch, but not master.


On 10/24/2014 07:40 PM, Diego Pino wrote:
>> local seen, matched = 0, 0 -   while ptr < ptr_end do -
>> local record = ffi.cast("struct pcap_record *", ptr) -      local
>> packet = ffi.cast("unsigned char *", record + 1) -      local
>> ptr_next = packet + record.incl_len -      if pred(packet,
>> record.incl_len) then -         matched = matched + 1 -      end 
>> +   for _,packet in ipairs(packets) do
> 
> Sure, if you think it can be worth, go ahead! I was curious about
> pairs and ipairs because I thought it could be a potential
> optimization for Snabbswitch.
> 
> But as far as I can see, there is no use of pairs nor ipairs in
> pflua-match currenytly :/

Not in trunk, but the last line of the patch above introduces it; I
can try rewriting that patch to work on arrays without using ipairs
and see what happens.