… | |
… | |
964 | Also, note that the number of watchers usually has a nonlinear effect on |
964 | Also, note that the number of watchers usually has a nonlinear effect on |
965 | overall speed, that is, creating twice as many watchers doesn't take twice |
965 | overall speed, that is, creating twice as many watchers doesn't take twice |
966 | the time - usually it takes longer. This puts event loops tested with a |
966 | the time - usually it takes longer. This puts event loops tested with a |
967 | higher number of watchers at a disadvantage. |
967 | higher number of watchers at a disadvantage. |
968 | |
968 | |
|
|
969 | To put the range of results into perspective, consider that on the |
|
|
970 | benchmark machine, handling an event takes roughly 1600 CPU cycles with |
|
|
971 | EV, 3100 CPU cycles with AnyEvent's pure perl loop and almost 3000000 CPU |
|
|
972 | cycles with POE. |
|
|
973 | |
969 | C<EV> is the sole leader regarding speed and memory use, which are both |
974 | C<EV> is the sole leader regarding speed and memory use, which are both |
970 | maximal/minimal, respectively. Even when going through AnyEvent, it uses |
975 | maximal/minimal, respectively. Even when going through AnyEvent, it uses |
971 | far less memory than any other event loop and is still faster than Event |
976 | far less memory than any other event loop and is still faster than Event |
972 | natively. |
977 | natively. |
973 | |
978 | |
… | |
… | |
1128 | =head3 Discussion |
1133 | =head3 Discussion |
1129 | |
1134 | |
1130 | The benchmark tries to test the performance of a typical small |
1135 | The benchmark tries to test the performance of a typical small |
1131 | server. While knowing how various event loops perform is interesting, keep |
1136 | server. While knowing how various event loops perform is interesting, keep |
1132 | in mind that their overhead in this case is usually not as important, due |
1137 | in mind that their overhead in this case is usually not as important, due |
1133 | to the small absolute number of watchers. |
1138 | to the small absolute number of watchers (that is, you need efficiency and |
|
|
1139 | speed most when you have lots of watchers, not when you only have a few of |
|
|
1140 | them). |
1134 | |
1141 | |
1135 | EV is again fastest. |
1142 | EV is again fastest. |
1136 | |
1143 | |
1137 | The C-based event loops Event and Glib come in second this time, as the |
1144 | The C-based event loops Event and Glib come in second this time, as the |
1138 | overhead of running an iteration is much smaller in C than in Perl (little |
1145 | overhead of running an iteration is much smaller in C than in Perl (little |
1139 | code to execute in the inner loop, and perl's function calling overhead is |
1146 | code to execute in the inner loop, and perl's function calling overhead is |
1140 | high, and updating all the data structures is costly). |
1147 | high, and updating all the data structures is costly). |
1141 | |
1148 | |
1142 | The pure perl event loop is much slower, but still competitive. |
1149 | The pure perl event loop is much slower, but still competitive. |
1143 | |
1150 | |
1144 | POE also performs much better in this case, but is is stillf ar behind the |
1151 | POE also performs much better in this case, but is is still far behind the |
1145 | others. |
1152 | others. |
1146 | |
1153 | |
1147 | =head3 Summary |
1154 | =head3 Summary |
1148 | |
1155 | |
1149 | =over 4 |
1156 | =over 4 |