hmm, i see names here are a bit confusing
update should be called draw instead, it provides html to render markers.
the simplest way to do what you are looking for is
//get selection range
var r = editor.getSelectionRange()
//add marker
var session = editor.session
r.start = session.doc.createAnchor(r.start)
r.end = session.doc.createAnchor(r.end)
r.id = session.addMarker(r, "ace_step", "text")
//to remove the marker
r.end.detach()
r.start.detach()
session.removeMarker(
r.id)
this should be fast enough for up to several hundred markers