Portland is by far less safe than San Francisco. It had double the homicides in 2022 with 2/3rds the population.
My point is that SF is a bit odd in that it's a county and city that ends very abruptly, and Oakland is a 12 minute car or BART or 25 minute ferry ride from Embarcadero, thus the crime stats in the bay don't make much sense until you start averaging them across the metro area. It's not that Oakland is crazy violent, it's just that the a lot of the most violent areas of the metro fall in its borders, it's not that SF has the most vagrant or larcenous population, it's that it has a good climate for it: lots of the soft targets and toothless police force.