Query with a limit
Always limit when you only need a few rows. It is the cheapest performance win there is.
var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^priority=1');
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();
while (gr.next()) {
gs.info(gr.getValue('number') + ' · ' + gr.getDisplayValue('assigned_to'));
}